<template>
  <div id="app">
    <div>
      <!-- 把路由循环出来 -->
      <template v-for='r in this.$router.options.routes'>
        <router-link style="margin: 5px" :to='r.path' :key='r.path'> #{{r.path}} </router-link>
      </template>
      <br>
      <br>
    </div>
    <keep-alive>
      <router-view />
    </keep-alive>
  </div>
</template>

<script>
export default {
  name: 'App',
  mounted() {
    // console.log(this.$router.options.routes) // 打印所有的路由信息
  }
}
</script>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}

</style>
